<?

	global $file,$Drafts,$img;
	
	$Drafts = $this->fmgr->open('temp:/drafts');
	$file = $this->file;
	
	// If the file's not in the docroot we're gonna have to draft it to view it.
	$img = $Drafts->latest_of($file);
	
	css_include('fmgr.css');
	smout()->add_css($this->icon('tools.css', 'imgtools'));
	js_include_shared('builder.js', 'dragdrop.js', 'cropper.js', 'slider.js');
	js_include_shared('codepress/codepress.js');
	js_include('Fmgr.js', 'file.js', 'imageedit.js');

	$Tlb = Toolbar();
	$Tlb->option('File')->option('Save')->toFunction('File.save();', 'File.write;');
	$Tlb->option('File')->option('Save As...')->toFunction('File.saveAs();');
	$Tlb->option('File')->option('Nice Name')->toFunction('Namer.begin();', '!is_null(window.O_ID)');
	$Tlb->option('File')->option('Link Here')->toFunction('Smajax.exec("newlink")');
	
	$Tlb->option('View')->option('File Contents')->toFunction('View.switchTo(0);', 'View.cur != 0;');
	$Tlb->option('View')->option('Meta Data')->toFunction('View.switchTo(1);', 'View.cur != 1;');
	$Tlb->option('View')->option('Arbitrary Meta')->toFunction('View.switchTo(2);', 'View.cur != 2;');
	$Tlb->option('View')->option('Shortcuts')->toFunction('showKeyboard()');
	
?>